import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0
import QtQuick.Dialogs 1.0
import QtQuick.Controls.Styles 1.0



Item {


    property int editIndex


    TitleText {
        id: titleText
        text: "Edit Skill"

        anchors.top: parent.top
        anchors.right: parent.right
        anchors.left: parent.left
        color: "white"
    }

    Column {
        anchors.top: titleText.bottom
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        anchors.topMargin: 12
        anchors.leftMargin: 9
        spacing: 9

        Column
        {
            anchors.left: parent.left
            anchors.right: parent.right
            spacing: 3

            Text {
                color: "white"
                text: "Name"
                font.bold: true
                anchors.left: parent.left
                anchors.right: parent.right
            }

            Rectangle {
                color: "white"
                anchors.left: parent.left
                anchors.right: parent.right
                height: 20

                TextInput {
                    text: skillsModel.get(editIndex).name
                    anchors.fill: parent
                    verticalAlignment: TextInput.AlignVCenter
                    anchors.margins: 3
                }
            }
        }

        Column
        {
            anchors.left: parent.left
            anchors.right: parent.right
            spacing: 3

            Text {
                color: "white"
                text: "Attribute"
                font.bold: true
                anchors.left: parent.left
                anchors.right: parent.right
            }

            ComboBox {
                model: attributeList
                currentIndex: skillsModel.get(editIndex).attribute
                anchors.left: parent.left
                anchors.right: parent.right
            }
        }

        Column
        {
            anchors.left: parent.left
            anchors.right: parent.right
            spacing: 3

            Text {
                color: "white"
                text: "Synergies"
                font.bold: true
                anchors.left: parent.left
                anchors.right: parent.right
            }

            Repeater {
                id: synergyRepeater
                model: skillsModel
                delegate: CheckBox {
                    anchors.left: parent.left
                    anchors.right: parent.right

                    visible: name !== skillsModel.get(editIndex).name

                    style: CheckBoxStyle {
                        label: Label {
                            color: "white"
                            text: name
                        }
                    }
                }
            }
        }

        Column
        {
            anchors.left: parent.left
            anchors.right: parent.right
            spacing: 3

            Button {
                text: "Apply"
                anchors.right: parent.right
            }
        }
    }
}


